<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="plugins/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
    <script type="text/javascript" src="plugins/ztree/js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="plugins/ztree/js/jquery.ztree.core-3.5.js"></script>
    <script type="text/javascript" src="plugins/ztree/js/jquery.ztree.excheck-3.5.js"></script>
</head>

<script>
    //1.通过ztree完成树形结构展示
    //1.配置ztree
    var setting = {
        check: {
            enable: true
        },
        data: {
            simpleData: {
                enable: true
            }
        }
    };
    //2.指定ztree的节点数据 ，json数组
    var zNodes =[
        { id:11, pId:1, name:"随意勾选 1-1"},           //每一个模块数据
        { id:111, pId:11, name:"随意勾选 1-1-1"},
        { id:112, pId:11, name:"随意勾选 1-1-2"},
        { id:12, pId:1, name:"随意勾选 1-2"},
        { id:121, pId:12, name:"随意勾选 1-2-1"},
        { id:122, pId:12, name:"随意勾选 1-2-2"},
        { id:2, pId:0, name:"随意勾选 2", checked:true},
        { id:21, pId:2, name:"随意勾选 2-1"},
        { id:22, pId:2, name:"随意勾选 2-2"},
        { id:221, pId:22, name:"随意勾选 2-2-1", checked:true},
        { id:222, pId:22, name:"随意勾选 2-2-2"},
        { id:23, pId:2, name:"随意勾选 2-3"},
        { id:1, pId:0, name:"随意勾选 1"}
    ];

    //3.在页面初始化的时候，加载ztree树
    $(document).ready(function(){
        //选择器，ztree配置，节点数据
        $.fn.zTree.init($("#treeDemo"), setting, zNodes);
    });


</script>
<body>
    <%--
      2.指定树形结构展示的位置
    --%>
    <div>
        <ul id="treeDemo" class="ztree"></ul>
    </div>
</body>
</html>
